package pt.mleiria.sAction.cfg;

import java.util.ArrayList;
import java.util.List;



public class Menu_Items {
	/**
	 * Uma List de Menu_Item
	 */
	private List menu_items;
	
	public Menu_Items() {
		menu_items = new ArrayList();
	}

	public void addMenu_Item(Menu_Item menu_item){
		menu_items.add(menu_item);
	}
	/**
	 * 
	 * @return o tamanho da List menu_items
	 */
	public int menuSize(){
		if(menu_items != null)
			return menu_items.size();
		else
			return 0;
	}
	/**
	 * 
	 * @param index
	 * @return o Menu_Item dentro da List cujo indice e = a index
	 */
	public Menu_Item getMenu_Item(int index){
		Menu_Item menu_item = null;
		if(menu_items != null && menu_items.size() > 0){
			if(index >= 0 && index < menu_items.size()){
				menu_item = (Menu_Item)menu_items.get(index);
			}else
				throw new IllegalArgumentException("O indice fornecido esta fora do intervalo ]0," + menu_items.size() + "[");
		}
		return menu_item;
	}
}
